home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
cmln0286.arc
/
DRIVER.C
< prev
next >
Wrap
Text File
|
1986-02-03
|
2KB
|
73 lines
THOMAS D. WEBB Listing Three, Page 1 of 2
1: /*------------------------------DRIVER.C-----------------------------------
2: * DRIVER.C Routines to illustrate the use of the symbolic debugger.
3: *
4: *
5: *------------------------------------------------------------------------*/
6: #include <stdio.h>
7: #include <debug.h>
8: /*-----------------------------------------------------------------------*/
9: func2() /* this illustrates a typical application of the debugger: */
10: { /* 1. record the entry into a function */
11: /* 2. record the program variables as they change */
12: /* 3. record the exit from the function */
13: int small_number;
14: long big_number;
15: TS("enter func2","-------------------");
16: for (small_number = 0, big_number = 0L; small_number < 5; small_number++)
17: {
18: big_number += small_number *10;
19: TI("small_number:",small_number);
20: TL("big_number:", big_number);
21: }
22: TS("exit func2","^^^^^^^^^^^^^^^^^^^");
23: } /*func2*/
24: /*-----------------------------------------------------------------------*/
25: func1() /*illustrate the use of all of the types of traces*/
26: {
27: char a = 'A';
28: int j = 123;
29: int *j_ptr = &j;
30: long k = 456789;
31: float f = 12.978;
32: static char string[] = "hello, world";
33: TS("enter func1","-------------------");
34: TC("Character test",a);
35: TI("Integer test",j);
36: TL("Long test",k);
37: TU("Unsigned test",j_ptr);
38: TF("Float test",f);
39: TD("Double test",123456.789012);
40: TS("String test",string);
41: TS("exit func1","^^^^^^^^^^^^^^^^^^^^");
42: } /*func1*/
43: /*-----------------------------------------------------------------------*/
THOMAS D. WEBB Listing Three, Page 2 of 2
44: main()
45: {
46: printf("Debug driver version 02 start\n");
47: printf("Press F10 to start trace\n");
48: inkey();
49: func1();
50: func2();
51: printf("Debug driver end\n");
52: } /*main*/
53: /*--------------------------END DRIVER.C---------------------------------*/
End Listing Three